 package server.commands;

 import client.MapleCharacter;
 import client.MapleCharacterUtil;
 import client.MapleClient;
 import client.MapleStat;
 import client.inventory.Equip;
 import client.inventory.Item;
 import client.inventory.ItemFlag;
 import client.inventory.MapleInventoryType;
 import client.skills.Skill;
 import client.skills.SkillFactory;
 import constants.GameConstants;
 import constants.ItemConstants;
 import constants.JobConstants;
 import handling.channel.ChannelServer;
 import handling.world.WorldBroadcastService;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import scripting.event.EventInstanceManager;
 import scripting.event.EventManager;
 import server.MapleInventoryManipulator;
 import server.MapleItemInformationProvider;
 import server.life.MapleMonster;
 import server.maps.MapleMap;
 import server.shop.MapleShopFactory;
 import tools.MaplePacketCreator;
 import tools.StringUtil;










 public class GMCommand
 {
/*  41 */   private static final Logger log = LogManager.getLogger(GMCommand.class);




   public static PlayerGMRank getPlayerLevelRequired() {
/*  47 */     return PlayerGMRank.GM;
   }


   public static class MapInfo
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/*  55 */       int xpos = (c.getPlayer().getPosition()).x;
/*  56 */       int ypos = (c.getPlayer().getPosition()).y;
/*  57 */       c.getPlayer().dropMessage(6, "当前地图信息: ID " + c.getPlayer().getMapId() + " 名字 " + c.getPlayer().getMap().getMapName() + " 您所在坐标信息: " + xpos + " / " + ypos);
/*  58 */       return 1;
     }
   }


   public static class GetSkill
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/*  67 */       Skill skill = SkillFactory.getSkill(Integer.parseInt(splitted[1]));
/*  68 */       byte level = (byte)CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);
/*  69 */       byte masterlevel = (byte)CommandProcessorUtil.getOptionalIntArg(splitted, 3, 1);

/*  71 */       if (level > skill.getMaxLevel()) {
/*  72 */         level = (byte)skill.getMaxLevel();
       }
/*  74 */       if (masterlevel > skill.getMaxLevel()) {
/*  75 */         masterlevel = (byte)skill.getMaxLevel();
       }
/*  77 */       c.getPlayer().changeSingleSkillLevel(skill, level, masterlevel);
/*  78 */       return 1;
     }
   }


   public static class Fame
     extends CommandExecute
   {
     public String getParameter() {
/*  87 */       return "<角色名> <要加人气的数量>";
     }


     public int execute(MapleClient c, String[] splitted) {
/*  92 */       MapleCharacter player = c.getPlayer();
/*  93 */       if (splitted.length < 2) {
/*  94 */         c.getPlayer().dropMessage(6, "用法: !fame " + getParameter());
/*  95 */         return 0;
       }
/*  97 */       MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
/*  98 */       int fame = 0;
       try {
/* 100 */         fame = Integer.parseInt(splitted[2]);
/* 101 */       } catch (NumberFormatException nfe) {
/* 102 */         c.getPlayer().dropMessage(6, "输入的数字无效...");
/* 103 */         return 0;
       }
/* 105 */       if (victim != null && player.allowedToTarget(victim)) {
/* 106 */         victim.addFame(fame);
/* 107 */         victim.updateSingleStat(MapleStat.人气, victim.getFame());
/* 108 */         GMCommand.log.info("[命令] 管理员 " + player.getName() + " 给玩家 " + victim.getName() + " 加人气 " + fame + " 点.");
       }
/* 110 */       return 1;
     }
   }


   public static class god
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 119 */       MapleCharacter player = c.getPlayer();
/* 120 */       Skill skill = SkillFactory.getSkill(1010);
/* 121 */       if (player.isInvincible()) {
/* 122 */         player.setInvincible(false);
/* 123 */         player.cancelEffect(skill.getEffect(1), false, -1L);
/* 124 */         player.dropMessage(6, "无敌模式已关闭.");
       } else {
/* 126 */         player.setInvincible(true);
/* 127 */         skill.getEffect(1).applyTo(player);
/* 128 */         player.dropMessage(6, "无敌模式已开启.");
       }
/* 130 */       return 1;
     }
   }


   public static class SP
     extends CommandExecute
   {
     public String getParameter() {
/* 139 */       return "<SP点数>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 144 */       if (splitted.length < 2) {
/* 145 */         c.getPlayer().dropMessage(6, "用法: !SP " + getParameter());
/* 146 */         return 0;
       }
/* 148 */       for (int i = 0; i < 4; i++) {
/* 149 */         c.getPlayer().setRemainingSp(CommandProcessorUtil.getOptionalIntArg(splitted, 1, 1), i);
       }
/* 151 */       c.getPlayer().updateSingleStat(MapleStat.AVAILABLESP, 0L);
/* 152 */       return 1;
     }
   }


   public static class Job
     extends CommandExecute
   {
     public String getParameter() {
/* 161 */       return "<职业ID>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 166 */       if (splitted.length < 2) {
/* 167 */         c.getPlayer().dropMessage(6, "用法: !job " + getParameter());
/* 168 */         return 0;
       }
/* 170 */       int jobId = Integer.parseInt(splitted[1]);
/* 171 */       if (JobConstants.getJobNameById(jobId).length() == 0) {
/* 172 */         c.getPlayer().dropMessage(5, "输入的职业id无效.");
/* 173 */         return 0;
       }
/* 175 */       c.getPlayer().changeJob(Integer.parseInt(splitted[1]));
/* 176 */       return 1;
     }
   }


   public static class Shop
     extends CommandExecute
   {
     public String getParameter() {
/* 185 */       return "<商店ID>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 190 */       if (splitted.length < 2) {
/* 191 */         c.getPlayer().dropMessage(6, "用法: !Shop " + getParameter());
/* 192 */         return 0;
       }
/* 194 */       MapleShopFactory shop = MapleShopFactory.getInstance();
/* 195 */       int shopId = Integer.parseInt(splitted[1]);
/* 196 */       if (shop.getShop(shopId) != null) {
/* 197 */         shop.getShop(shopId).sendShop(c);
       }
/* 199 */       return 1;
     }
   }


   public static class LevelUp
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 208 */       if (c.getPlayer().getLevel() < 250) {
/* 209 */         c.getPlayer().gainExp(500000000L, true, false, true);
       }
/* 211 */       return 1;
     }
   }


   public static class GetItem
     extends CommandExecute
   {
     public String getParameter() {
/* 220 */       return "<道具ID> <道具数量>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 225 */       if (splitted.length < 2) {
/* 226 */         c.getPlayer().dropMessage(6, "用法: !GetItem " + getParameter());
/* 227 */         return 0;
       }
/* 229 */       int itemId = Integer.parseInt(splitted[1]);
/* 230 */       short quantity = (short)CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);
/* 231 */       if (!c.getPlayer().isAdmin()) {
/* 232 */         for (int i : GameConstants.itemBlock) {
/* 233 */           if (itemId == i) {
/* 234 */             c.getPlayer().dropMessage(5, "对不起，您当前管理权限无法刷出这个装备.");
/* 235 */             return 0;
           }
         }
       }
/* 239 */       if (!c.getPlayer().isSuperGM()) {
/* 240 */         switch (itemId / 10000) {
           case 202:
           case 204:
           case 229:
           case 251:
           case 253:
           case 261:
           case 400:
           case 401:
           case 402:
           case 403:
           case 413:
           case 417:
           case 425:
           case 431:
           case 506:
/* 256 */             c.getPlayer().dropMessage(5, "对不起，您当前管理权限无法刷出这个装备.");
/* 257 */             return 0;
         }
       }
/* 260 */       MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
/* 261 */       if (ItemConstants.isPet(itemId)) {
/* 262 */         c.getPlayer().dropMessage(5, "宠物道具请通过商城购买.");
/* 263 */       } else if (!ii.itemExists(itemId)) {
/* 264 */         c.getPlayer().dropMessage(5, itemId + " 这个道具不存在.");
       } else {
         Item item;
        short flag = (short) ItemFlag.封印.getValue();
        if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
            item = ii.randomizeStats((Equip) ii.getEquipById(itemId));
        } else {
            item = new client.inventory.Item(itemId, (byte) 0, !c.getPlayer().isSuperGM() ? 1 : quantity, (byte) 0);
        }
        if (!c.getPlayer().isSuperGM()) {
            item.setFlag(flag);
        }
        if (!c.getPlayer().isAdmin()) {
            item.setOwner(c.getPlayer().getName());
        }
        item.setGMLog(c.getPlayer().getName() + " 使用命令 !getitem");
        MapleInventoryManipulator.addbyItem(c, item);
        log.info("[命令] 管理员 " + c.getPlayer().getName() + " 刷道具: " + item.getItemId() + " 数量: " + item.getQuantity() + " 名称: " + ii.getName(itemId));
       }
/* 283 */       return 1;
     }
   }


   public static class GetItemAll
     extends CommandExecute
   {
     public String getParameter() {
/* 292 */       return "<道具ID> <道具数量>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 297 */       if (splitted.length < 2) {
/* 298 */         c.getPlayer().dropMessage(6, "用法: !GetItemAll " + getParameter());
/* 299 */         return 0;
       }
/* 301 */       int itemId = Integer.parseInt(splitted[1]);
/* 302 */       short quantity = (splitted.length < 3) ? 1 : (short)CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);
/* 303 */       MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
/* 304 */       if (!ii.itemExists(itemId)) {
/* 305 */         c.getPlayer().dropMessage(5, itemId + " 这个道具不存在.");
/* 306 */       } else if (ItemConstants.isPet(itemId)) {
/* 307 */         c.getPlayer().dropMessage(5, "宠物道具请通过商城购买.");
       }
/* 309 */       int succ = 0, error = 0;
/* 310 */       for (MapleCharacter player : ChannelServer.getInstance(1).getMapFactory().getMap(910000000).getCharacters()) {
/* 311 */         if (player != null && player.haveSpaceForId(itemId)) {
           Item item;
            if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
                item = ii.randomizeStats((Equip) ii.getEquipById(itemId));
            } else {
                item = new client.inventory.Item(itemId, (byte) 0, !c.getPlayer().isSuperGM() ? 1 : quantity, (byte) 0);
            }
            item.setGMLog(c.getPlayer().getName() + " 使用命令 !GetItemAll");
            MapleInventoryManipulator.addbyItem(player.getClient(), item);
            log.info("[命令] 管理员 " + c.getPlayer().getName() + " 使用全服刷道具, 玩家名: " + player.getName() + " 道具: " + item.getItemId() + " 数量: " + item.getQuantity() + " 名称: " + ii.getName(itemId));
            player.dropMessage(1, "恭喜你获得管理员赠送的 " + ii.getName(itemId) + " " + quantity + "个。");
            player.dropMessage(6, "[系统公告] 恭喜你获得管理员赠送的 " + ii.getName(itemId) + " " + quantity + "个。");
            succ++;
         }
/* 325 */         error++;
       }

/* 328 */       c.getPlayer().dropMessage(1, "命令使用完毕。\r\n发送成功: " + succ + "\r\n发送失败: " + error);
/* 329 */       return 1;
     }
   }


   public static class GetItemAll2
     extends CommandExecute
   {
     public String getParameter() {
/* 338 */       return "<道具ID> <道具数量>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 343 */       if (splitted.length < 2) {
/* 344 */         c.getPlayer().dropMessage(6, "用法: !GetItemAll2 " + getParameter());
/* 345 */         return 0;
       }
/* 347 */       int itemId = Integer.parseInt(splitted[1]);
/* 348 */       short quantity = (splitted.length < 3) ? 1 : (short)CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);
/* 349 */       MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
/* 350 */       if (!ii.itemExists(itemId)) {
/* 351 */         c.getPlayer().dropMessage(5, itemId + " 这个道具不存在.");
/* 352 */       } else if (ItemConstants.isPet(itemId)) {
/* 353 */         c.getPlayer().dropMessage(5, "宠物道具请通过商城购买.");
       }
/* 355 */       int succ = 0, error = 0;
/* 356 */       for (ChannelServer channel : ChannelServer.getAllInstances()) {
/* 357 */         for (MapleCharacter player : channel.getPlayerStorage().getAllCharacters()) {
/* 358 */           if (player != null && player.haveSpaceForId(itemId)) {
             Item item;
                if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
                    item = ii.randomizeStats((Equip) ii.getEquipById(itemId));
                } else {
                    item = new client.inventory.Item(itemId, (byte) 0, !c.getPlayer().isSuperGM() ? 1 : quantity, (byte) 0);
                }
                item.setGMLog(c.getPlayer().getName() + " 使用命令 !GetItemAll2");
                MapleInventoryManipulator.addbyItem(player.getClient(), item);
                log.info("[命令] 管理员 " + c.getPlayer().getName() + " 使用全服刷道具, 玩家名: " + player.getName() + " 道具: " + item.getItemId() + " 数量: " + item.getQuantity() + " 名称: " + ii.getName(itemId));
                player.dropMessage(1, "恭喜你获得管理员赠送的 " + ii.getName(itemId) + " " + quantity + "个。");
                player.dropMessage(6, "[系统公告] 恭喜你获得管理员赠送的 " + ii.getName(itemId) + " " + quantity + "个。");
                succ++;
           }
/* 372 */           error++;
         }
       }

/* 376 */       c.getPlayer().dropMessage(1, "命令使用完毕。\r\n发送成功: " + succ + "\r\n发送失败: " + error);
/* 377 */       return 1;
     }
   }


   public static class Level
     extends CommandExecute
   {
     public String getParameter() {
/* 386 */       return "<等级>";
     }

     public int execute(MapleClient c, String[] splitted) {
       int change;
/* 391 */       if (splitted.length < 2) {
/* 392 */         c.getPlayer().dropMessage(6, "用法: !level " + getParameter());
/* 393 */         return 0;
       }

       try {
/* 397 */         change = Integer.parseInt(splitted[1]);
/* 398 */       } catch (NumberFormatException nfe) {
/* 399 */         c.getPlayer().dropMessage(6, "输入的数字无效.");
/* 400 */         return 0;
       }
/* 402 */       if (change <= 0 || change > 275) {
/* 403 */         c.getPlayer().dropMessage(6, "调整的等级范围出错，默认范围[1-275]");
/* 404 */         return 0;
       }
/* 406 */       c.getPlayer().setLevel((short)(change - 1));
/* 407 */       c.getPlayer().levelUp();
/* 408 */       return 1;
     }
   }


   public static class delitem
     extends CommandExecute
   {
     public String getParameter() {
/* 417 */       return "<角色名字> <道具ID>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 422 */       if (splitted.length < 3) {
/* 423 */         c.getPlayer().dropMessage(6, "用法: !delitem " + getParameter());
/* 424 */         return 0;
       }
/* 426 */       MapleCharacter chr = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
/* 427 */       if (chr == null) {
/* 428 */         c.getPlayer().dropMessage(6, "输入的角色不存在或者角色不在线或者不在这个频道.");
/* 429 */         return 0;
       }
/* 431 */       chr.removeAll(Integer.parseInt(splitted[2]), false, false);
/* 432 */       c.getPlayer().dropMessage(6, "已经成功的将ID为: " + splitted[2] + " 的所有道具从角色: " + splitted[1] + " 的背包中删除.");
/* 433 */       return 1;
     }
   }


   public static class lockitem
     extends CommandExecute
   {
     public String getParameter() {
/* 442 */       return "<角色名> <道具ID>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 447 */       if (splitted.length < 3) {
/* 448 */         c.getPlayer().dropMessage(6, "用法: !lockitem " + getParameter());
/* 449 */         return 0;
       }
/* 451 */       MapleCharacter chr = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
/* 452 */       if (chr == null) {
/* 453 */         c.getPlayer().dropMessage(6, "输入的角色不存在或者角色不在线或者不在这个频道.");
/* 454 */         return 0;
       }
/* 456 */       int itemid = Integer.parseInt(splitted[2]);
/* 457 */       MapleInventoryType type = ItemConstants.getInventoryType(itemid);
/* 458 */       for (Item item : chr.getInventory(type).listById(itemid)) {
/* 459 */         item.setFlag((short)(byte)(item.getFlag() | ItemFlag.封印.getValue()));
/* 460 */         chr.forceUpdateItem(item);
       }
/* 462 */       if (type == MapleInventoryType.EQUIP) {
/* 463 */         type = MapleInventoryType.EQUIPPED;
/* 464 */         for (Item item : chr.getInventory(type).listById(itemid)) {
/* 465 */           item.setFlag((short)(byte)(item.getFlag() | ItemFlag.封印.getValue()));
/* 466 */           chr.forceUpdateItem(item);
         }
       }
/* 469 */       c.getPlayer().dropMessage(6, "已经成功的将ID为: " + splitted[2] + " 的所有道具锁定,执行角色为: " + splitted[1] + ".");
/* 470 */       return 1;
     }
   }


   public static class KillMap
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 479 */       for (MapleCharacter map : c.getPlayer().getMap().getCharactersThreadsafe()) {
/* 480 */         if (map != null && !map.isGM()) {
/* 481 */           map.updateSingleStat(MapleStat.HP, 0L);
/* 482 */           map.updateSingleStat(MapleStat.MP, 0L);
/* 483 */           map.getStat().setHp(0, map);
/* 484 */           map.getStat().setMp(0, map);
         }
       }
/* 487 */       return 1;
     }
   }


   public static class SpeakMega
     extends CommandExecute
   {
     public String getParameter() {
/* 496 */       return "<角色名> <文本内容>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 501 */       if (splitted.length < 2) {
/* 502 */         c.getPlayer().dropMessage(6, "用法: !SpeakMega " + getParameter());
/* 503 */         return 0;
       }
/* 505 */       MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
/* 506 */       WorldBroadcastService.getInstance().broadcastSmega(MaplePacketCreator.serverNotice(3, (victim == null) ? c.getChannel() : victim.getClient().getChannel(), (victim == null) ? splitted[1] : (victim.getName() + " : " + StringUtil.joinStringFrom(splitted, 2)), true));

/* 508 */       return 1;
     }
   }


   public static class Speak
     extends CommandExecute
   {
     public String getParameter() {
/* 517 */       return "<角色名> <文本内容>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 522 */       if (splitted.length < 3) {
/* 523 */         c.getPlayer().dropMessage(6, "用法: !Speak " + getParameter());
/* 524 */         return 0;
       }
/* 526 */       MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
/* 527 */       if (victim == null) {
/* 528 */         c.getPlayer().dropMessage(5, "没有找到 " + splitted[1] + " 玩家.");
/* 529 */         return 0;
       }
/* 531 */       victim.getMap().broadcastMessage(MaplePacketCreator.getChatText(victim.getId(), StringUtil.joinStringFrom(splitted, 2), victim.getName(), victim.isGM(), 0));

/* 533 */       return 1;
     }
   }


   public static class Disease
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 542 */       if (splitted.length < 3) {
/* 543 */         c.getPlayer().dropMessage(6, "!disease <type> [charname] <level> where type = SEAL/DARKNESS/WEAKEN/STUN/CURSE/POISON/SLOW/SEDUCE/REVERSE/ZOMBIFY/POTION/SHADOW/BLIND/FREEZE/POTENTIAL");
/* 544 */         return 0;
       }
/* 546 */       int type = 0;
/* 547 */       if (splitted[1].equalsIgnoreCase("SEAL")) {
/* 548 */         type = 120;
/* 549 */       } else if (splitted[1].equalsIgnoreCase("DARKNESS")) {
/* 550 */         type = 121;
/* 551 */       } else if (splitted[1].equalsIgnoreCase("WEAKEN")) {
/* 552 */         type = 122;
/* 553 */       } else if (splitted[1].equalsIgnoreCase("STUN")) {
/* 554 */         type = 123;
/* 555 */       } else if (splitted[1].equalsIgnoreCase("CURSE")) {
/* 556 */         type = 124;
/* 557 */       } else if (splitted[1].equalsIgnoreCase("POISON")) {
/* 558 */         type = 125;
/* 559 */       } else if (splitted[1].equalsIgnoreCase("SLOW")) {
/* 560 */         type = 126;
/* 561 */       } else if (splitted[1].equalsIgnoreCase("SEDUCE")) {
/* 562 */         type = 128;
/* 563 */       } else if (splitted[1].equalsIgnoreCase("REVERSE")) {
/* 564 */         type = 132;
/* 565 */       } else if (splitted[1].equalsIgnoreCase("ZOMBIFY")) {
/* 566 */         type = 133;
/* 567 */       } else if (splitted[1].equalsIgnoreCase("POTION")) {
/* 568 */         type = 134;
/* 569 */       } else if (splitted[1].equalsIgnoreCase("SHADOW")) {
/* 570 */         type = 135;
/* 571 */       } else if (splitted[1].equalsIgnoreCase("BLIND")) {
/* 572 */         type = 136;
/* 573 */       } else if (splitted[1].equalsIgnoreCase("FREEZE")) {
/* 574 */         type = 137;
/* 575 */       } else if (splitted[1].equalsIgnoreCase("POTENTIAL")) {
/* 576 */         type = 138;
       } else {
/* 578 */         c.getPlayer().dropMessage(6, "!disease <type> [charname] <level> where type = SEAL/DARKNESS/WEAKEN/STUN/CURSE/POISON/SLOW/SEDUCE/REVERSE/ZOMBIFY/POTION/SHADOW/BLIND/FREEZE/POTENTIAL");
/* 579 */         return 0;
       }
/* 581 */       if (splitted.length == 4) {
/* 582 */         MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[2]);
/* 583 */         if (victim == null) {
/* 584 */           c.getPlayer().dropMessage(5, "无法找到角色.");
/* 585 */           return 0;
         }
/* 587 */         victim.disease(type, CommandProcessorUtil.getOptionalIntArg(splitted, 3, 1));
       } else {
/* 589 */         for (MapleCharacter victim : c.getPlayer().getMap().getCharactersThreadsafe()) {
/* 590 */           victim.disease(type, CommandProcessorUtil.getOptionalIntArg(splitted, 3, 1));
         }
       }
/* 593 */       return 1;
     }
   }


   public static class SetInstanceProperty
     extends CommandExecute
   {
     public String getParameter() {
/* 602 */       return "<事件名> <Key> <Value>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 607 */       if (splitted.length < 4) {
/* 608 */         c.getPlayer().dropMessage(6, "用法: !SetInstanceProperty " + getParameter());
/* 609 */         return 0;
       }
/* 611 */       EventManager em = c.getChannelServer().getEventSM().getEventManager(splitted[1]);
/* 612 */       if (em == null || em.getInstances().size() <= 0) {
/* 613 */         c.getPlayer().dropMessage(5, "none");
       } else {
/* 615 */         em.setProperty(splitted[2], splitted[3]);
/* 616 */         for (EventInstanceManager eim : em.getInstances()) {
/* 617 */           eim.setProperty(splitted[2], splitted[3]);
         }
       }
/* 620 */       return 1;
     }
   }


   public static class ListInstanceProperty
     extends CommandExecute
   {
     public String getParameter() {
/* 629 */       return "<事件名> <属性名>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 634 */       if (splitted.length < 3) {
/* 635 */         c.getPlayer().dropMessage(6, "用法: !ListInstanceProperty " + getParameter());
/* 636 */         return 0;
       }
/* 638 */       EventManager em = c.getChannelServer().getEventSM().getEventManager(splitted[1]);
/* 639 */       if (em == null || em.getInstances().size() <= 0) {
/* 640 */         c.getPlayer().dropMessage(5, "none");
       } else {
/* 642 */         for (EventInstanceManager eim : em.getInstances()) {
/* 643 */           c.getPlayer().dropMessage(5, "活动脚本: " + eim.getName() + ", eventManager: " + em.getName() + " iprops: " + eim.getProperty(splitted[2]) + ", eprops: " + em.getProperty(splitted[2]));
         }
       }
/* 646 */       return 0;
     }
   }


   public static class LeaveInstance
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 655 */       if (c.getPlayer().getEventInstance() == null) {
/* 656 */         c.getPlayer().dropMessage(5, "You are not in one");
       } else {
/* 658 */         c.getPlayer().getEventInstance().unregisterPlayer(c.getPlayer());
       }
/* 660 */       return 1;
     }
   }


   public static class WhosThere
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 669 */       StringBuilder builder = (new StringBuilder("当前地图玩家: ")).append(c.getPlayer().getMap().getCharactersThreadsafe().size()).append(" 人. ");
/* 670 */       for (MapleCharacter chr : c.getPlayer().getMap().getCharactersThreadsafe()) {
/* 671 */         if (builder.length() > 150) {
/* 672 */           builder.setLength(builder.length() - 2);
/* 673 */           c.getPlayer().dropMessage(6, builder.toString());
/* 674 */           builder = new StringBuilder();
         }
/* 676 */         builder.append(MapleCharacterUtil.makeMapleReadable(chr.getName()));
/* 677 */         builder.append(", ");
       }
/* 679 */       builder.setLength(builder.length() - 2);
/* 680 */       c.getPlayer().dropMessage(6, builder.toString());
/* 681 */       return 1;
     }
   }


   public static class StartInstance
     extends CommandExecute
   {
     public String getParameter() {
/* 690 */       return "<事件名> <事件实例名>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 695 */       if (c.getPlayer().getEventInstance() != null) {
/* 696 */         c.getPlayer().dropMessage(5, "You are in one");
/* 697 */       } else if (splitted.length > 2) {
/* 698 */         EventManager em = c.getChannelServer().getEventSM().getEventManager(splitted[1]);
/* 699 */         if (em == null || em.getInstance(splitted[2]) == null) {
/* 700 */           c.getPlayer().dropMessage(5, "Not exist");
         } else {
/* 702 */           em.getInstance(splitted[2]).registerPlayer(c.getPlayer());
         }
       } else {
/* 705 */         c.getPlayer().dropMessage(5, "用法: !startinstance " + getParameter());
       }
/* 707 */       return 1;
     }
   }



   public static class resetmob
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 717 */       c.getPlayer().getMap().killAllMonsters(false);
/* 718 */       return 1;
     }
   }


   public static class KillMonsterByOID
     extends CommandExecute
   {
     public String getParameter() {
/* 727 */       return "<怪物OID>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 732 */       if (splitted.length < 2) {
/* 733 */         c.getPlayer().dropMessage(6, "用法: !KillMonsterByOID " + getParameter());
/* 734 */         return 0;
       }
/* 736 */       MapleMap map = c.getPlayer().getMap();
/* 737 */       int targetId = Integer.parseInt(splitted[1]);
/* 738 */       MapleMonster monster = map.getMonsterByOid(targetId);
/* 739 */       if (monster != null) {
/* 740 */         map.killMonster(monster, c.getPlayer(), false, false, (byte)1);
       }
/* 742 */       return 1;
     }
   }


   public static class resetnpc
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 751 */       c.getPlayer().getMap().resetNPCs();
/* 752 */       return 1;
     }
   }

   public static class Notice
     extends CommandExecute
   {
     public String getParameter() {
/* 760 */       return "<m/c/w m:当前地图 c:当前频道 w:全服> <n/p/l/nv/v/b n:[公告事项] p:提示框 l:小喇叭 nv/v:红色字 b:蓝色字> <文本内容>";
     }





     protected static int getNoticeType(String typestring) {
/* 768 */       switch (typestring) {
         case "n":
/* 770 */           return 0;
         case "p":
/* 772 */           return 1;
         case "l":
/* 774 */           return 2;
         case "nv":
/* 776 */           return 5;
         case "v":
/* 778 */           return 5;
         case "b":
/* 780 */           return 6;
       }
/* 782 */       return -1;
     }


     public int execute(MapleClient c, String[] splitted) {
/* 787 */       if (splitted.length < 4) {
/* 788 */         c.getPlayer().dropMessage(6, "用法: !notice " + getParameter());
       }
/* 790 */       int joinmod = 1;
/* 791 */       int range = -1;
/* 792 */       switch (splitted[1]) {
         case "m":
/* 794 */           range = 0;
           break;
         case "c":
/* 797 */           range = 1;
           break;
         case "w":
/* 800 */           range = 2;
           break;
       }

/* 804 */       int tfrom = 2;
/* 805 */       if (range == -1) {
/* 806 */         range = 2;
/* 807 */         tfrom = 1;
       }
/* 809 */       int type = getNoticeType(splitted[tfrom]);
/* 810 */       if (type == -1) {
/* 811 */         type = 0;
/* 812 */         joinmod = 0;
       }
/* 814 */       StringBuilder sb = new StringBuilder();
/* 815 */       if (splitted[tfrom].equals("nv")) {
/* 816 */         sb.append("[Notice]");
       }

/* 819 */       joinmod += tfrom;
/* 820 */       sb.append(StringUtil.joinStringFrom(splitted, joinmod));

/* 822 */       byte[] packet = MaplePacketCreator.serverNotice(type, sb.toString());
/* 823 */       if (range == 0) {
/* 824 */         c.getPlayer().getMap().broadcastMessage(packet);
/* 825 */       } else if (range == 1) {
/* 826 */         ChannelServer.getInstance(c.getChannel()).broadcastPacket(packet);
/* 827 */       } else if (range == 2) {
/* 828 */         WorldBroadcastService.getInstance().broadcastMessage(packet);
       }
/* 830 */       return 1;
     }
   }


   public static class Yellow
     extends CommandExecute
   {
     public String getParameter() {
/* 839 */       return "<m/c/w> <文本内容>";
     }


     public int execute(MapleClient c, String[] splitted) {
/* 844 */       if (splitted.length < 3) {
/* 845 */         c.getPlayer().dropMessage(6, "用法: !Yellow " + getParameter());
/* 846 */         return 0;
       }
/* 848 */       int range = -1;
/* 849 */       switch (splitted[1]) {
         case "m":
/* 851 */           range = 0;
           break;
         case "c":
/* 854 */           range = 1;
           break;
         case "w":
/* 857 */           range = 2;
           break;
       }
/* 860 */       if (range == -1) {
/* 861 */         range = 2;
       }
/* 863 */       byte[] packet = MaplePacketCreator.yellowChat((splitted[0].equals("y") ? ("[" + c.getPlayer().getName() + "] ") : "") + StringUtil.joinStringFrom(splitted, 2));
/* 864 */       if (range == 0) {
/* 865 */         c.getPlayer().getMap().broadcastMessage(packet);
/* 866 */       } else if (range == 1) {
/* 867 */         ChannelServer.getInstance(c.getChannel()).broadcastPacket(packet);
/* 868 */       } else if (range == 2) {
/* 869 */         WorldBroadcastService.getInstance().broadcastMessage(packet);
       }
/* 871 */       return 1;
     }
   }


   public static class Y
     extends Yellow {}


   public static class WhatsMyIP
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 884 */       c.getPlayer().dropMessage(5, "IP: " + c.getSessionIPAddress());
/* 885 */       return 1;
     }
   }






   public static class TempBanIP
     extends InternCommand.TempBan {}





   public static class BanIP
     extends InternCommand.Ban {}





   public static class TDrops
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 912 */       c.getPlayer().getMap().toggleDrops();
/* 913 */       return 1;
     }
   }
 }


/* Location:              C:\PGX\Server.jar!\server\commands\GMCommand.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */